<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;

class ClickLearnMenuSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        if (!DB::table('admin_menu')->where('title','内容管理')->exists()) {
            DB::table('admin_menu')->insert([
                'parent_id' => 0,
                'order' =>  DB::table('admin_menu')
                        ->max('order')+1,
                'title' => '内容管理',
                'icon' => 'fa-folder-open-o',
                'extension' => '',
                'show' => 1,
                'created_at' => now(),
                'updated_at' => now(),
            ]);
        }
        $admin_menu=DB::table('admin_menu')->first();
        if (!DB::table('admin_menu')->where('title','内容列表')->exists()) {
            DB::table('admin_menu')->insert([
                'parent_id' => $admin_menu->id,
                'order' =>  DB::table('admin_menu')
                        ->max('order')+1,
                'title' => '内容列表',
                'uri' => '/clickLearn',
                'extension' => '',
                'show' => 1,
                'created_at' => now(),
                'updated_at' => now(),
            ]);
        }
        $this->command->info('内容数据填充完成！');
    }

}
